package com.jinzheng.qhnetty.commont.errnetty;//package com.jinzheng.qhnetty.commont.errnetty;
//
//import io.netty.channel.ChannelInitializer;
//import io.netty.channel.ChannelPipeline;
//import io.netty.channel.socket.SocketChannel;
//import io.netty.handler.codec.string.StringDecoder;
//import io.netty.handler.codec.string.StringEncoder;
//import io.netty.handler.timeout.IdleStateHandler;
//import org.springframework.stereotype.Component;
//
//import java.util.concurrent.TimeUnit;
//
//@Component
//public class SocketInitializer extends ChannelInitializer<SocketChannel> {
//
//    //这里可以使用Autowired引入需要的bean，通过参数的形式传给handler12
//    @Override
//    protected void initChannel(SocketChannel ch) throws Exception {
//        ChannelPipeline pipeline = ch.pipeline();
//        pipeline.addLast(new StringDecoder());
//        pipeline.addLast(new StringEncoder());
//        pipeline.addLast(new IdleStateHandler(6, 0, 0, TimeUnit.SECONDS));
//        pipeline.addLast(new ServerHandler());
//    }
//}